<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%request.setCharacterEncoding("gbk") ;%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	HttpSession httpSession = request.getSession();
	httpSession.setAttribute("userName", "admin");
	httpSession.setAttribute("password", "admin");

	System.out.print("<!----- sessionId= " + httpSession.getId());
	
	System.out.print(" connection= 127.0.0.1:8082 ");
	
	System.out.print(" userName= "
			+ httpSession.getAttribute("userName"));
	System.out.print(" password= "
			+ httpSession.getAttribute("password"));
	System.out.print(" ----->");
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
     欢迎你：<%=request.getParameter("username") %>1
   Server Info:  
	<%  
	out.println(request.getLocalAddr() + " : " + request.getLocalPort()+"<br>");%>  
	<%  
	  out.println("<br> ID " + session.getId()+"<br>");  
	    
	  String dataName = request.getParameter("dataName");  
	  if (dataName != null && dataName.length() > 0) {  
	     String dataValue = request.getParameter("dataValue");  
	     session.setAttribute(dataName, dataValue);  
	     System.out.println("application:" + application.getAttribute(dataName));  
	     application.setAttribute(dataName, dataValue);  
	  }  
	  out.print("<b>Session List</b>");  
	  Enumeration<String> e = session.getAttributeNames();  
	  while (e.hasMoreElements()) {  
	     String name = e.nextElement();  
	     String value = session.getAttribute(name).toString();  
	     out.println( name + " = " + value+"<br>");  
	         System.out.println( name + " = " + value);  
	   }  
	%>  
  <form action="loginOk.jsp" method="POST">  
        Name:<input type=text size=20 name="dataName">  
     <br>  
        Value:<input type=text size=20 name="dataValue">  
     <br>  
    <input type=submit>  
   </form>  
     
</body>
</html>